/**
 * Created by Administrator on 2017/2/17.
 */
import React, {Component, PropTypes} from 'react';
import {Header} from '../header/header'
import {initFunction,fade} from '../../scripts/tip';
import {getQueryString} from '../../scripts/url';
import {inintAddress,addAddress} from '../../scripts/address'


export default class Address extends Component {
    componentDidMount() {

        fade();

        var url=location.href;

        //TODO getProductId
        var productType=getQueryString("productType",url);

        inintAddress(productType);

        initFunction();

        $('.AddressDetailBtn').click(function(){
            addAddress(productType);
        })
    }

    render(){
        return <div className="Address">
            <Header headerTitle="收货信息"  className="back"/>
            <AddressDetails />
            <AddressDetailBtn />
        </div>
    }
}

export  class AddressDetails extends Component {

        componentDidMount() {

            $("#citys").citySelect({
                nodata:"none",
                required:false
            });

    }
    render(){
        return <div className="AddressDetails fadeaction">
           <form id="addAddress">

                <input type="hidden" name="productType"  />

               <div className="border-tb title">
                   <span>收货人</span> <input type="text" name="realName"/>
               </div>
               <div className="border-tb title">
                   <span>手机号</span> <input type="tel" name="telephone"/>
               </div>
               <div className="border-tb title travel sex">
                   <span>性别</span>
                   <select name="gender">
                       <option name="sex" value={0}>男</option>
                       <option name="sex" value={1}>女</option>
                   </select>
               </div>
               <div className="border-tb title Id travel">
                   <span>身份证号</span> <input type="text" name="idNumber"/>
               </div>
               <div className="border-tb title travel">
                   <span>身高(cm)</span> <input type="text" name="height"/>
               </div>
               <div className="border-tb title travel">
                   <span>微信账号</span> <input type="text" name="wechatId"/>
               </div>
               <div className="border-tb title Material ">
                   <span>选择区域</span>
                   <div id="citys" className="citys">
                       <p>
                           <select name="province" className="prov">
                           </select>
                           <select name="city" className="city">
                           </select>
                           <select name="dist" className="dist">
                           </select>
                       </p>
                   </div>
               </div>
               <div className="border-tb title addrDetails Material">
                   <span>详细地址</span>
                <textarea rows="7" type="text" name="address">
                </textarea>
               </div>
           </form>
        </div>
    }
}

export  class AddressDetailBtn extends Component {

    render(){
        return <div className="AddressDetailBtn">
            <a href="javascript:;">保存</a>
        </div>
    }

}